Crispo - Excel Challenge 52 2025

excel-challenges
weekly-exercises
Easy Sunday Excel Challenge
Published

December 28, 2025

Illustration for Crispo - Excel Challenge 52 2025

Challenge Description

Easy Sunday Excel Challenge

⭐ ⭐Extract the Day and Time from the Shifts

Solutions

library(tidyverse)
library(readxl)

path <- "2025-12-28/Challenge 88.xlsx"
input <- read_excel(path, range = "B3:D8")
test <- read_excel(path, range = "F3:K8")

result = input %>%
  mutate(
    Shifts = str_replace_all(
      Shifts,
      "(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)",
      "|"
    )
  ) %>%
  separate_wider_delim(
    Shifts,
    delim = "|",
    names_sep = "",
    too_few = "align_start"
  ) %>%
  select(starts_with("Shifts")) %>%
  mutate(across(c(4, 6), as.double))

all((result == test) | (is.na(result) & is.na(test)))
# [1] TRUE
  • Logic:

    • Reads the workbook range needed for the challenge

    • Builds the intermediate helper columns that drive the final answer

    • Uses direct text-pattern extraction instead of manual cleanup

  • Strengths:

    • The R solution stays compact and mirrors the workbook logic closely.
  • Areas for Improvement:

    • The code assumes the workbook layout and named ranges remain stable.
  • Gem:

    • The best part of the solution is choosing a tidy intermediate shape before producing the final answer.
import pandas as pd

path = "2025-12-28/Challenge 88.xlsx"

inp = pd.read_excel(path, usecols="B:D", skiprows=2, nrows=6)
tst = pd.read_excel(path, usecols="F:K", skiprows=2, nrows=6)

res = (
    inp.assign(
        Shifts=lambda d: d.Shifts.str.replace(
            r"(?<=\D)(?=\d)|(?<=\d)(?=\D)", "|", regex=True
        )
    )["Shifts"]
    .str.split("|", expand=True)
)
res.columns = tst.columns
res.iloc[:, [1, 3, 5]] = res.iloc[:, [1, 3, 5]].astype(float)

print(((res.values == tst.values) | (pd.isna(res) & pd.isna(tst))).all())
  • Logic:

    • Reads the workbook range needed for the challenge

    • Builds the intermediate helper columns that drive the final answer

  • Strengths:

    • The Python version keeps the same rule in a direct pandas-oriented workflow.
  • Areas for Improvement:

    • As with the R version, any workbook layout change would require small adjustments.
  • Gem:

    • The implementation stays close to the stated challenge instead of adding unnecessary complexity.

Difficulty Level

This task is moderate:

  • It combines familiar Excel-style logic with at least one non-trivial reshape, grouping, or parsing step.

  • The answer depends on getting the output layout exactly right.